%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/functions/custom-query-random-user-array"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: Access[7], Access[8], Object[9]<br />2: PgSelect[6]<br />3: PgSelectRows[10]"):::bucket
    Bucket1("Bucket 1 (listItem)<br /><br />ROOT __Item{1}ᐸ10ᐳ[11]"):::bucket
    Bucket2("Bucket 2 (nullableBoundary)<br />Deps: 12<br /><br />ROOT PgSelectSingle{1}ᐸrandom_user_arrayᐳ[12]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2

    %% plan dependencies
    Object9{{"Object[9∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Access7{{"Access[7∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access8{{"Access[8∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access7 & Access8 --> Object9
    PgSelect6[["PgSelect[6∈0] ➊<br />ᐸrandom_user_arrayᐳ"]]:::plan
    Object9 --> PgSelect6
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access7
    __Value2 --> Access8
    PgSelectRows10[["PgSelectRows[10∈0] ➊"]]:::plan
    PgSelect6 --> PgSelectRows10
    __Item11[/"__Item[11∈1]<br />ᐸ10ᐳ"\]:::itemplan
    PgSelectRows10 ==> __Item11
    PgSelectSingle12{{"PgSelectSingle[12∈1]<br />ᐸrandom_user_arrayᐳ"}}:::plan
    __Item11 --> PgSelectSingle12
    PgClassExpression13{{"PgClassExpression[13∈2]<br />ᐸ__random_u...”username”ᐳ"}}:::plan
    PgSelectSingle12 --> PgClassExpression13
    PgClassExpression14{{"PgClassExpression[14∈2]<br />ᐸ__random_u...vatar_url”ᐳ"}}:::plan
    PgClassExpression13 o--o PgClassExpression14

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect6,Access7,Access8,Object9,PgSelectRows10 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1,__Item11,PgSelectSingle12 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2,PgClassExpression13,PgClassExpression14 bucket2

